﻿using LeonardoNews.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Data.Entity.ModelConfiguration.Configuration;

namespace LeonardoNews.Data
{
    public class NewsContext : DbContext
    {
        public NewsContext()
            : base("News")
        {
            this.Configuration.ProxyCreationEnabled = false;
        }

        public DbSet<User> Users { get; set; }
        
        public DbSet<Article> Articles { get; set; }
        
        public DbSet<Comment> Comments { get; set; }
        
        public DbSet<Vote> Votes { get; set; }

        //protected override void OnModelCreating(DbModelBuilder modelBuilder)
        //{
        //    modelBuilder.Entity<Comment>().HasRequired(c => c.ParentComment).WithMany(c => c.Children).WillCascadeOnDelete();
        //}
    }
}
